#ifndef BASIC_ITEM_COMMANDS_H
#define BASIC_ITEM_COMMANDS_H

#include <ieditoritem.h>

#include <QtCore/QPointF>
#include <QtGui/QUndoCommand>

QT_BEGIN_NAMESPACE
class QGraphicsItem;
QT_END_NAMESPACE

namespace swp
{
class GraphicData;

class ItemMoveCommand : public QUndoCommand
{
public:
    ItemMoveCommand(GraphicData* data, core::IGraphicEditorItem* item,
        const QPointF& oldPos, const QPointF& newPos);
    ~ItemMoveCommand();

    void undo();
    void redo();

private:
    GraphicData* m_data;
    core::IGraphicEditorItem* m_item;
    QPointF m_oldPos;
    QPointF m_newPos;
};

class AnchorMoveCommand : public QUndoCommand
{
public:
    AnchorMoveCommand(QGraphicsItem* item,
        const QPointF& oldPos, const QPointF& newPos);
    ~AnchorMoveCommand();

    void undo();
    void redo();

private:
    QGraphicsItem* m_item;
    QPointF m_oldPos;
    QPointF m_newPos;
};

class ConnectPointMoveCommand : public QUndoCommand
{
public:
    ConnectPointMoveCommand(QGraphicsItem* item,
        const QPointF& oldPos, const QPointF& newPos);
    ~ConnectPointMoveCommand();

    void undo();
    void redo();

private:
    QGraphicsItem* m_item;
    QPointF m_oldPos;
    QPointF m_newPos;
};

class PropertyChangeCommand : public QUndoCommand
{
public:
    PropertyChangeCommand(core::IEditorItem* item,
        const core::Property& property, const QVariant& newValue);
    ~PropertyChangeCommand();

    void undo();
    void redo();

private:
    core::IEditorItem* m_item;
    QString m_propName;
    QVariant m_newValue;
    QVariant m_oldValue;
};

} // namespace swp

#endif
